<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\SoftDeletes;
use Illuminate\Database\Eloquent\Model as BaseModel;
use Illuminate\Database\Eloquent\Relations\BelongsTo;

class DictionaryModel extends BaseModel
{
    use HasFactory, SoftDeletes;

    protected $table = 't_dictionary';

    protected $primaryKey = 'id';

    public $timestamps = true;

    const UPDATED_AT = null;

    //是否系统内置
    const SYSTME = 1;
    const NO_SYSTME = 2;

    protected $guarded = [];

    protected $hidden = [
        'deleted_at',
    ];

    public function type(): BelongsTo {
        return $this->belongsTo(DictionaryTypeModel::class, 'type_id', 'id');
    }

    public function admin(): BelongsTo {
        return $this->belongsTo(AdminModel::class, 'admin_id', 'id');
    }

}
